#define _CRT_SECURE_NO_WARNINGS 1
#include "Head.h"
class Solution {
public:
    string removeDuplicates(string s) {
        stack<char> st;
        for (char ch : s)
        {
            if (ch == st.top())
            {
                st.pop();
            }
            st.push(ch);
        }
        string ans;
        while (!st.empty())
        {
            ans += st.top();
            st.pop();
        }
        reverse(ans.begin(), ans.end());
        return ans;
    }
};

int main()
{
    //Solution s;
    //string str = "abbaca" ;
    //auto ans = s.removeDuplicates(str);
    //cout << ans << endl;

    //int ret = 10;
    //cout << -ret << endl;
}